// import service from "@/utils/request";
import xjaxiosOnline from "@/api/axios";
export default {
  /**
   * @description: 用户登录
   * @param {String} account
   * @param {String} password
   * @return {Object}
   */
  login(params) {
    // 公司
    return xjaxiosOnline.post("virtualSystem/web/newLogin", `username=${params.username}&account=${params.username}&password=${params.password}`);
  },
  /**
   * @description: 用户操作注册
   * @param {String} account
   * @param {String} password
   * @return {Object}
   */
  loginErr(params) {
    return xjaxiosOnline.post("config/loginLog/add", { userName: params });
  },
  /**
   * @description: 查顶级组织公司结构数据，返回为公司列表
   * @return {Object}
   */
  organizationTop() {
    return xjaxiosOnline.get("virtualSystem/queryTopOrganization", {
    });
  },
  /**
   * @description: 根据顶级组织查询组织列表
   * @return {Object}
   */
  queryOrganization(no) {
    return xjaxiosOnline.get(`virtualSystem/queryOrganization?topOrganizationNo=${no}`);
  },
  /**
   * @description: 根据组织列表查询下级组织树状
   * @return {Object}
   */
  queryTreeByOrganizationNoList(list) {
    return xjaxiosOnline.get(`organization/organization/queryTreeByOrganizationNoList?noList=${list}`);
  },
  /**
   * @description: 根据组织查询系统列表
   * @return {Object}
   */
  queryVirtualSystem(no) {
    return xjaxiosOnline.get(`authority/v1/virtualSystem/queryVirtualSystem?organizationNo=${no}`);
  },

  getOrganizationBigScreen(no) {
    return xjaxiosOnline.post(`organization/organizationBigScreen/queryByCondition`, {
      organizationNo: no
    });
  },
  getBigScreen(no) {
    return xjaxiosOnline.post(`organization/organization/queryByCondition`, {
      organizationNo: no
    });
  },
  // 查询所有菜单
  queryMenuAlls(no) {
    return xjaxiosOnline.get(`authority/v1/menu/getUserMenuByFarmingType?no=${sessionStorage.farmingTypeNo}`);
  },
  // 查询所有菜单
  queryMenuAll(no) {
    return xjaxiosOnline.get(`authority/v1/menu/getSystemMenu?virtualSystemNo=${no}`);
  },

  // 获取数据库名称
  queryDatabaseNameByOrganizationNo(no) {
    return xjaxiosOnline.get(`organization/organizationToDatabaseMapper/queryByOrganizationNo?no=${no}`);
  },

  // 查询页面元素列表
  queryPageElement(no) {
    return xjaxiosOnline.get(`authority/v1/pageElement/queryPageElement?virtualSystemNo=${no}`);
  },
  // 查询页面养殖类型字段列表
  queryfieldTemplate(no) {
    return xjaxiosOnline.get(`/config/fieldTemplate/queryByBreedTypeNo?no=${no}`);
  },

  /**
   * @description: 获取农场列表
   * @param {String} companyId
   * @return {Array}
   */
  farmListbyOrganizationId(params) {
    return xjaxiosOnline.get(
      `/oa/oauth/getSuborganization/${params}`);
  },
  /**
   * @description: 获取获取树状列表
   * @param {String} organizationtId
   * @return {Array}
   */
  gettreelist(params) {
    return xjaxiosOnline.get(`/organizationManage/organization/loginChildel/${params}`)
  },
  // gettreeslist(params) {
  //   return xjaxiosOnline.get(`/organizationManage/organization/queryTreeList/${params}`)
  // },
  gettreeslist(params) {
    return xjaxiosOnline.get(`organization/organization/queryChildOrganizationNo?organizationNo=${params}`)
  },
  /**
   * @description: 通过id获取子节点列表
   * @param {String} organizationtId
   * @return {Array}
   */
  // getchildidlist(params) {
  //   return xjaxiosOnline.get(`/organizationManage/organization/queryIdList/${params}`)
  // },
  getchildidlist(params) {
    // return xjaxiosOnline.post(`organization/organizationFarmingTypeMapper/queryByCondition`, params)
    return xjaxiosOnline.get(`organization/organization/queryChildOrganizationNo?organizationNo=${params}`, params)
  },
  /**
   * @description: 通过数据库名字
   * @param {String} organizationtId
   * @return {Array}
   */
  getdatabasename(params) {
    return xjaxiosOnline.get(`/organizationManage/organizationDatabaseMapper/queryByOrgId/${params}`)
  },
  /**
   * @description: 获取栋舍组-所有
   * @param {String} organizationtId
   * @return {Array}
   */
  getFacilityGroup() {
    return xjaxiosOnline.post(`/facilityManage/facilityGroup/queryAllByOrgIdList`, {
      farmingTypeNo: sessionStorage.getItem('farmingTypeNo'),
      organizationList: sessionStorage.getItem("organizationList").split(','),
      facilityStatus: 1
    })
  },
  /**
   * @description: 获取栋舍组id查地块-所有
   * @param {String} organizationtId
   * @return {Array}
   */
  getdikuaiGroup(param) {
    return xjaxiosOnline.get(`facilityManage/facilityGroupMapper/queryByFacilityGroupId/${param}`)
  },
  /**
   * @description: 直接获取所有地块
   * @param {String} organizationtId
   * @return {Array}
   */
  getfacilityAll(params) {
    return xjaxiosOnline.post("breedFacility/facility/queryByCondition", params)
  },
  // ----注册相关----
  /**
   * @description: 获取组织结构树状图
   */
  getcompanyregist(e) {
    return xjaxiosOnline.get(`organization/organization/queryOrganizationLike?organizationName=${e}`)
  },

  batchToParentByChild(params) {
    return xjaxiosOnline.get(`organization/organization/queryParentByChild?organizationNo=${params}`)
  },
  /**
   * @description: 用户上传信息
   */
  registuser(params) {
    return xjaxiosOnline.post("person/auditUser/add", {
      expired: false,
      auditFlag: 0,
      systemIdStr: "OM1-SC",
      ...params
    })
  },
  regisSecurityQuestion(params) {
    return xjaxiosOnline.post("person/securityQuestion/addList", {
      ...params
    })
  },
  /**
   * @description: 获取组织结构树状图
   */
  gettodapingurl() {
    return xjaxiosOnline.post("organizationManage/driveOrgnizationMapper/queryByCondition", {
      organizationNo: sessionStorage.getItem('organizationNo')
    })
  },
  getOrganization() {
    return xjaxiosOnline.get(`organization/organization/query?organizationNo=${sessionStorage.getItem('organizationNo')}`)
  },
  // 判断承租人
  getSystemzation() {
    return xjaxiosOnline.get(`virtualSystem/v1/user/queryDetailInfo?username=${sessionStorage.account}`)
    // return xjaxiosOnline.get(`person/user/queryDetailInfo?userNo=${sessionStorage.userNo}`)
  }
};
